import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 保养项设置信息 */
export interface EquipmentKeepSetting {
  id: number // id
  keepType?: number // 保养项分类
  name?: string // 保养项名称
  status: number // 状态
  keepMethod?: string // 保养方法
  keepNorm?: string // 保养标准
  description?: string // 描述
}

// 保养项设置 API
export const EquipmentKeepSettingApi = {
  // 查询保养项设置分页
  getEquipmentKeepSettingPage: async (params: any) => {
    return await request.get({ url: `/business/equipment-keep-setting/page`, params })
  },

  // 查询保养项设置分页
  getEquipmentKeepSettingPageNew: async (params: any) => {
    return await request.get({ url: `/business/equipment-keep-setting/pageNew`, params })
  },

  // 查询保养项设置分页
  getEquipmentKeepSettingList: async (params: any) => {
    return await request.get({ url: `/business/equipment-keep-setting/allList`, params })
  },

  // 查询保养项设置详情
  getEquipmentKeepSetting: async (id: number) => {
    return await request.get({ url: `/business/equipment-keep-setting/get?id=` + id })
  },

  // 新增保养项设置
  createEquipmentKeepSetting: async (data: EquipmentKeepSetting) => {
    return await request.post({ url: `/business/equipment-keep-setting/create`, data })
  },

  // 修改保养项设置
  updateEquipmentKeepSetting: async (data: EquipmentKeepSetting) => {
    return await request.put({ url: `/business/equipment-keep-setting/update`, data })
  },

  // 删除保养项设置
  deleteEquipmentKeepSetting: async (id: number) => {
    return await request.delete({ url: `/business/equipment-keep-setting/delete?id=` + id })
  },

  /** 批量删除保养项设置 */
  deleteEquipmentKeepSettingList: async (ids: number[]) => {
    return await request.delete({
      url: `/business/equipment-keep-setting/delete-list?ids=${ids.join(',')}`
    })
  },

  /** 批量获取保养项设置 */
  getEquipmentKeepSettingListByIds: async (ids: number[]) => {
    return await request.get({
      url: `/business/equipment-keep-setting/id-list?ids=${ids.join(',')}`
    })
  },

  // 导出保养项设置 Excel
  exportEquipmentKeepSetting: async (params) => {
    return await request.download({ url: `/business/equipment-keep-setting/export-excel`, params })
  },

  // 下载导入模板
  importTemplate: async () => {
    return request.download({ url: '/business/equipment-keep-setting/get-import-template' })
  },

  //维护模块的=============================================

  // 查询保养项设置分页
  getEquipmentKeepSettingPageDamage: async (params: any) => {
    return await request.get({ url: `/Damage/equipment-keep-setting/page`, params })
  },

  // 查询保养项设置分页
  getEquipmentKeepSettingPageNewDamage: async (params: any) => {
    return await request.get({ url: `/Damage/equipment-keep-setting/pageNew`, params })
  },

  // 查询保养项设置分页
  getEquipmentKeepSettingListDamage: async (params: any) => {
    return await request.get({ url: `/Damage/equipment-keep-setting/allList`, params })
  },

  // 查询保养项设置详情
  getEquipmentKeepSettingDamage: async (id: number) => {
    return await request.get({ url: `/Damage/equipment-keep-setting/get?id=` + id })
  },

  // 新增保养项设置
  createEquipmentKeepSettingDamage: async (data: EquipmentKeepSetting) => {
    return await request.post({ url: `/Damage/equipment-keep-setting/create`, data })
  },

  // 修改保养项设置
  updateEquipmentKeepSettingDamage: async (data: EquipmentKeepSetting) => {
    return await request.put({ url: `/Damage/equipment-keep-setting/update`, data })
  },

  // 删除保养项设置
  deleteEquipmentKeepSettingDamage: async (id: number) => {
    return await request.delete({ url: `/Damage/equipment-keep-setting/delete?id=` + id })
  },

  /** 批量删除保养项设置 */
  deleteEquipmentKeepSettingListDamage: async (ids: number[]) => {
    return await request.delete({
      url: `/Damage/equipment-keep-setting/delete-list?ids=${ids.join(',')}`
    })
  },

  /** 批量获取保养项设置 */
  getEquipmentKeepSettingListByIdsDamage: async (ids: number[]) => {
    return await request.get({
      url: `/Damage/equipment-keep-setting/id-list?ids=${ids.join(',')}`
    })
  },

  // 导出保养项设置 Excel
  exportEquipmentKeepSettingDamage: async (params) => {
    return await request.download({ url: `/Damage/equipment-keep-setting/export-excel`, params })
  },

  // 下载导入模板
  importTemplateDamage: async () => {
    return request.download({ url: '/Damage/equipment-keep-setting/get-import-template' })
  }
}
